public class Teacher {
    private String name;
    private String produce;
    private int age;

    public void show(){
        System.out.println("老师的名字是"+name+"；老师的年龄是："+age+"；老师的自我介绍是："+produce+"；老师的学校是:北大青鸟。");
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setAge(int age) throws Exception {
        this.age = age;
        if(age<22){
            throw new Exception("年龄过小。");
        }
    }

    public int getAge() {
        return age;
    }

    public String getProduce() {
        return produce;
    }

    public void setProduce(String produce) {
        this.produce = produce;
    }
}
